import styles from './users.scss';
import { useParams } from 'umi';
import { useUserInfo } from '@/layouts';

function UserPage() {
  const params: any = useParams();
  const id = params.id;
  return UserInfo(id);
}

UserPage.title = 'user';

function UserInfo(id: string) {
  const user = useUserInfo();
  if (!user) {
    return <div>Loading</div>;
  }
  return (
    <div className={styles.list}>
      <span>id: {user.id + '-' + id}</span>
      <span>name: {user.name}</span>
      <span>age: {user.age}</span>
    </div>
  );
}

export default UserPage;
